//
//  KeyBoard.swift
//  MeiLiTV
//
//  Created by 冰凉的枷锁 on 2017/3/31.
//  Copyright © 2017年 冰凉的枷锁. All rights reserved.
//

import Foundation
import UIKit

class KeyBoard {
    /*
    func keyboard() {
        
        //监听键盘的弹出 输入工具条上移
        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(kbWillShow:) name:UIKeyboardWillShowNotification object:nil];
        //监听键盘的推出 输入框恢复到原位
        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(kbWillHide:) name:UIKeyboardWillHideNotification object:nil];
    }
    
    #pragma mark -------键盘显示会触发的方法
    - (void)kbWillShow:(NSNotification *)notification {
    //获取键盘的高度
    CGRect kbEndFram = [notification.userInfo[UIKeyboardFrameEndUserInfoKey] CGRectValue];
    CGFloat kbHeight = kbEndFram.size.height;
    CGFloat scHeight = [[UIScreen mainScreen] bounds].size.height;
    
    //添加动画
    if ([self.addressTextField isFirstResponder] && scHeight - kbHeight < 304) {
    [UIView animateWithDuration:0.25 animations:^{
    self.topConstraint.constant = kbHeight + 284 - scHeight;
    [self.view layoutIfNeeded];
    }];
    }
    }
    #pragma mark ------键盘隐藏时候会触发的方法
    - (void)kbWillHide:(NSNotification *)notification {
    [UIView animateWithDuration:0.25 animations:^{
    self.topConstraint.constant = 20;
    [self.view layoutIfNeeded];
    }];
    }
 */
}
